#ifndef SCREEN_H
#define SCREEN_H

#include "ak_common.h"
#include "ak_common_graphics.h"
#include "ak_tde.h"

/* 目标：准备好一堆读取好的图层对象，后面要用到的参数主要是宽和高， 一般不改截取方式 */
/* 对图层作操作时，源图层的所有参数都有用，而目标图层长宽代表图层大小，截取方式代表放置位置 */
/* 准备好屏幕图层对象，只需要给屏幕图层赋值，再切换即可 */
/* 只需要不断在屏幕图层叠东西 */
/* 如果同时操作缩放和透明度，将会丢失透明度属性，并以参数给的统一一个透明度 */

/* 方针：不做缩放，只做不同透明度的贴图 */
#define LEN_HINT                    512
#define LEN_PATH                    1024
#define LEN_DATA                    256
#define LEN_OPTION_SHORT            512

#define DEFAULT_WIDTH               1024
#define DEFAULT_HEIGHT              600
#define DEFAULT_POS_TOP             0
#define DEFAULT_POS_LEFT            0
#define DEFAULT_POS_WIDTH           1024
#define DEFAULT_POS_HEIGHT          600
#define DEFAULT_FORMAT              TDE_FORMAT_RGB888
#define DEFAULT_FILE_SRC            "./ak_tde_s_test.rgb"
#define DEFAULT_FILE_BG             "./ak_tde_bg_test.rgb"
#define DEFAULT_DIR_YUV             "./yuv"
#define DEFAULT_NUM_BUFFYUV         10

#define LEN_OFFSET_V                4                                           //yuv��uֵƫ���� y=0 u=h*w v=h*w+h*w/4
#define YUV_TEST_PRINT              100
#define DEV_GUI                     "/dev/fb0"                                  //gui lcdʹ�õ��豸����
#define SIZE_ERROR                  0xffffffff
#define USEC2SEC                    1000000

#define BITS_PER_PIXEL              24
#define BITS_PER_PIXEL565           16
#define LEN_COLOR                   8
#define DUAL_FB_FIX                 fb_fix_screeninfo_param.reserved[ 0 ]
#define DUAL_FB_VAR                 fb_var_screeninfo_param.reserved[ 0 ]

#ifndef AK_SUCCESS
#define AK_SUCCESS 0
#endif

#ifndef AK_FAILED
#define AK_FAILED -1
#endif

enum color_offset {
	OFFSET_RED = 16,
	OFFSET_GREEN = 8,
	OFFSET_BLUE = 0,
	OFFSET565_RED = 11,
	OFFSET565_GREEN = 5,
	OFFSET565_BLUE = 0,
};

struct regloop {
	//regex_t regex_t_use ;
	char *pc_pattern;
	int i_flags;
	int i_offset ;
	int i_times;
} ;

int ScreenInit();

/**
 * @brief 
 * 
 * @param bg_layer 
 * @return int 
 */
int LayerInit(struct ak_tde_layer *_layer, char *file_path);

/**
 * @brief 
 * 
 * @param bg_layer 需要提供源图片的长宽
 * @return int 
 */
int PutBgLayer(struct ak_tde_layer *bg_layer);

/**
 * @brief 
 * 
 * @param _layer 
 * @return int 
 */
int AddLayer(struct ak_tde_layer *_layer, int centerX, int centerY);

/**
 * @brief 
 * 
 * @param center_left 
 * @param center_top 
 * @param width 
 * @param height 
 * @return int 
 */
int FillRect(int center_left, int center_top, int width, int height);

/**
 * @brief 
 * 
 * @return int 
 */
int ScreenOutput();

#endif